<?php

namespace App\Models;


use App\Service\Base\Model;

class OrderUser extends Model
{

    // 用户管理
    protected $table = 'order_user';

    // 缓存字段，用于搜索绑定的字段
    protected $cacheFields = ['id', 'order_id', 'event_id', 'uid', 'order_uid'];

    // {"id":"自编号","uid":"用户ID","order_id":"订单id","event_id":"活动id","student_id":"学员ID","order_uid":"订单用户","person_name":"姓名","head_img":"随机的头像","sex":"性别（1-男，2-女，0-保密）","age":"年龄","guardor":"监护人","mobile":"手机号","status":"状态 0-未接入 1-正常接入 -1-删除","is_remind":"是否提醒 1-是","ctime":"注册时间","mtime":"更新时间"}

    // array ( 'id' => '$this->getData("id", null, "trim")', 'uid' => '$this->getData("uid", null, "trim")', 'order_id' => '$this->getData("order_id", null, "trim")', 'event_id' => '$this->getData("event_id", null, "trim")', 'student_id' => '$this->getData("student_id", null, "trim")', 'order_uid' => '$this->getData("order_uid", null, "trim")', 'person_name' => '$this->getData("person_name", null, "trim")', 'head_img' => '$this->getData("head_img", null, "trim")', 'sex' => '$this->getData("sex", null, "trim")', 'age' => '$this->getData("age", null, "trim")', 'guardor' => '$this->getData("guardor", null, "trim")', 'mobile' => '$this->getData("mobile", null, "trim")', 'status' => '$this->getData("status", null, "trim")', 'is_remind' => '$this->getData("is_remind", null, "trim")', 'ctime' => '$this->getData("ctime", null, "trim")', 'mtime' => '$this->getData("mtime", null, "trim")', )


    //$id = $this->getData("id", null, 'trim'); $uid = $this->getData("uid", null, 'trim'); $order_id = $this->getData("order_id", null, 'trim'); $event_id = $this->getData("event_id", null, 'trim'); $student_id = $this->getData("student_id", null, 'trim'); $order_uid = $this->getData("order_uid", null, 'trim'); $person_name = $this->getData("person_name", null, 'trim'); $head_img = $this->getData("head_img", null, 'trim'); $sex = $this->getData("sex", null, 'trim'); $age = $this->getData("age", null, 'trim'); $guardor = $this->getData("guardor", null, 'trim'); $mobile = $this->getData("mobile", null, 'trim'); $status = $this->getData("status", null, 'trim'); $is_remind = $this->getData("is_remind", null, 'trim'); $ctime = $this->getData("ctime", null, 'trim'); $mtime = $this->getData("mtime", null, 'trim');


    // 定义验证操作
    public function rules()
    {

        $add = [
        ];

        $edit = [
        ];

        $info = [
        ];


        $rule = [
            'uid'         => 'required',
            'order_id'    => 'required',
            'event_id'    => 'required',
            //'student_id'  => 'required',
            //'order_uid'   => 'required',
            'person_name' => 'required',
            'head_img'    => 'required',
            'sex'         => 'required',
            'age'         => 'required',
            //'guardor'     => 'required',
            'mobile'      => 'required',
            'status'      => 'in:-1,0,1',
            'is_remind'   => 'in:0,1',
        ];


        $msg = [
            'id'          => '自编号',
            'uid'         => '用户ID',
            'order_id'    => '订单id',
            'event_id'    => '活动id',
            'student_id'  => '学员ID',
            'order_uid'   => '订单用户',
            'person_name' => '姓名',
            'head_img'    => '随机的头像',
            'sex'         => '性别（1-男，2-女，0-保密）',
            'age'         => '年龄',
            'guardor'     => '监护人',
            'mobile'      => '手机号',
            'status'      => '状态 0-未接入 1-正常接入 -1-删除',
            'is_remind'   => '是否提醒 1-是',
            'ctime'       => '注册时间',
            'mtime'       => '更新时间',
        ];

        return ['rule' => $rule, 'msg' => $msg, 'add' => $add];
    }
}
